import 'package:flutter/material.dart';
import 'package:flutter_basic_learning/widgets/CommonHeader.dart';
import 'package:get/get.dart';

class LoginPage extends StatefulWidget {
  final String title;
  const LoginPage({super.key, this.title = ''});

  @override
  State<LoginPage> createState() => _LoginPageState();
}

class _LoginPageState extends State<LoginPage> {
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    print('111');
    print('arguments: ${Get.arguments}');
  }

  Widget body() {
    Widget body = Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        Text('LoginPage'),
        ElevatedButton(
            onPressed: () {
              Navigator.of(context).pushNamed('/home');
            },
            child: Text('跳转到HomePage'))
      ],
    );
    body = SizedBox.expand(child: body);
    return body;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: PreferredSize(
            preferredSize: Size.fromHeight(50),
            child: CommonHeader(title: 'LoginPage')),
        body: body());
  }
}
